package cn.wolfcode.luowowo.search.domain;

import lombok.Getter;
import lombok.Setter;
import org.springframework.data.annotation.Id;

import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.io.Serializable;

/**
 * 用户搜索对象
 */
@Getter
@Setter
@Document(indexName="luowowo_userinfo",type="userinfo")
public class UserInfoEs implements Serializable {

    public static final String INDEX_NAME = "luowowo_userinfo";
    public static final String TYPE_NAME = "userinfo";


    @Id                                                          //spring.data.elasticsearch.repositories.enable=true
    //@Field 每个文档的字段配置（类型、是否分词、是否存储、分词器 ）store=true的意思是要不要储存(和配置里同样的功能)
   @Field(store=true, index = false,type = FieldType.Keyword)
    private String id;  //用户id

    @Field(index=true,analyzer="ik_max_word",store=true,searchAnalyzer="ik_max_word",type = FieldType.Text)
    private String nickname;

    @Field(index=true,store=true,type = FieldType.Keyword)
    private String city;
    //ik_max_word分词器(拆碎,一个字一个字的)  Text:用来全部搜索的
    @Field(index=true,analyzer="ik_max_word",store=true,searchAnalyzer="ik_max_word",type = FieldType.Text)
    private String info;
}